Skip to content

feat: send error tracking stack frames in canonical bottom-up order#254

Draft
cat-ph wants to merge 1 commit into
mainfrom
cat/canonical-frame-order
Draft

feat: send error tracking stack frames in canonical bottom-up order#254
cat-ph wants to merge 1 commit into
mainfrom
cat/canonical-frame-order

Conversation

@cat-ph

@cat-ph cat-ph commented Jul 3, 2026

Copy link
Copy Markdown

Problem

PostHog SDKs disagree on the order of stack frames inside $exception_list[].stacktrace.frames. posthog-go currently emits frames in Go's native runtime.CallersFrames order (innermost first, crash/capture site at index 0), while the canonical cross-SDK convention being standardized in PostHog/sdk-specs#11 is bottom-up: entry point first, crash site last. Mixed conventions make the same logical error group, fingerprint, and display differently per platform.

Changes

  • DefaultStackTraceExtractor.GetStackTrace reverses the collected frames after the runtime.CallersFrames loop, emitting canonical wire order (frames[0] = outermost/entry point, last = capture site). This matches the already-canonical NativeStackTraceExtractor.
  • The single-element $exception_list behavior is unchanged.
  • Changeset with a minor bump.

Tests

  • Reversed the ordered expectations in the four existing table cases and updated the skip/cap case names and comments (skip drops the tail now; the 64-frame cap drops the head).
  • New regression test TestDefaultStackTraceExtractor_CanonicalWireOrder: first frame = entry point (runtime.goexit), last frame = capture site (runtime.Callers).
  • go build ./..., go vet ./..., focused error-tracking suite: 31 passed.

Coordination

This is a breaking wire-order change. Do not merge/release until the ingestion pipeline's normalization gate (cymbal) is live; it gates legacy payloads per $lib/$lib_version, so this must ship as a minor release. Part of the cross-SDK ordering standardization tracked in PostHog/sdk-specs#11.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

posthog-go Compliance Report

Date: 2026-07-03 00:16:52 UTC
Duration: 169149ms

⚠️ Some Tests Failed

109/111 tests passed, 2 failed


Capture_V1 Tests

94/94 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint 25ms
Endpoint And Method.Does Not Use Legacy Endpoints 5ms
Required Headers.Has Authorization Bearer Header 6ms
Required Headers.Has Content Type Json 5ms
Required Headers.Has Posthog Sdk Info Format 6ms
Required Headers.Has Posthog Attempt Header 5ms
Required Headers.Has Posthog Request Id 6ms
Required Headers.Has Posthog Request Timestamp 6ms
Required Headers.Has User Agent 6ms
Body Format.Body Has Created At And Batch 6ms
Body Format.No Api Key In Body 6ms
Body Format.No Sent At In Body 5ms
Event Format.Event Has Required Root Fields 6ms
Event Format.Event Uuid Is Valid 6ms
Event Format.Event Timestamp Is Rfc3339 6ms
Event Format.Distinct Id Is String 6ms
Event Format.Distinct Id At Root Not Properties 5ms
Event Format.Custom Properties Preserved 6ms
Event Format.Set Properties Preserved 6ms
Event Format.Set Once Properties Preserved 6ms
Event Format.Groups Properties Preserved 16ms
Event Format.Sdk Generates Uuid If Not Provided 6ms
Event Format.Event Has Required Root Fields Batch 8ms
Event Format.Event Uuid Is Valid Batch 8ms
Event Format.Event Timestamp Is Rfc3339 Batch 8ms
Event Format.Distinct Id Is String Batch 9ms
Event Format.Distinct Id At Root Not Properties Batch 8ms
Event Format.Custom Properties Preserved Batch 8ms
Event Format.Set Properties Preserved Batch 8ms
Event Format.Set Once Properties Preserved Batch 9ms
Event Format.Groups Properties Preserved Batch 8ms
Event Format.Sdk Generates Uuid If Not Provided Batch 8ms
Batch Behavior.Multiple Events In Single Batch 31ms
Batch Behavior.Batch Envelope Smoke 10ms
Batch Behavior.Flush With No Events Sends Nothing 3ms
Batch Behavior.Flush At Triggers Batch 1007ms
Batch Behavior.Created At Reflects Batch Creation Time 7ms
Deduplication.Generates Unique Uuids 15ms
Deduplication.Different Events Same Content Different Uuids 7ms
Deduplication.Preserves Uuid On Retry 5135ms
Deduplication.Preserves Timestamp On Retry 5136ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5133ms
Deduplication.No Duplicate Events In Batch 31ms
Header Behavior On Retry.Attempt Header Starts At One 6ms
Header Behavior On Retry.Attempt Header Increments On Retry 10139ms
Header Behavior On Retry.Request Id Preserved On Retry 5136ms
Header Behavior On Retry.Different Requests Have Different Request Ids 2014ms
Header Behavior On Retry.Request Timestamp Changes On Retry 5134ms
Response Format Validation.Success Response Has Uuid Keyed Results 7ms
Response Format Validation.Success Response Has Ok For Each Event 28ms
Response Format Validation.Success No Retry After When All Ok 27ms
Response Format Validation.Success Retry After Present When Retry Events 129ms
Response Format Validation.Success No Retry After When Drop Only 28ms
Response Format Validation.Response Echoes Request Id 6ms
Retry Behavior.Retries On 408 5134ms
Retry Behavior.Retries On 500 5136ms
Retry Behavior.Retries On 503 5135ms
Retry Behavior.Retries On 504 5135ms
Retry Behavior.Retryable Errors Have Retry After 2134ms
Retry Behavior.Respects Retry After On Retryable Error 8133ms
Retry Behavior.Does Not Retry On 400 2133ms
Retry Behavior.Does Not Retry On 401 2132ms
Retry Behavior.Does Not Retry On 402 2133ms
Retry Behavior.Does Not Retry On 413 2132ms
Retry Behavior.Does Not Retry On 415 2133ms
Retry Behavior.Non Retryable Errors Have No Retry After 2133ms
Retry Behavior.Implements Backoff 15142ms
Retry Behavior.Max Retries Respected 15143ms
Partial Batch Handling.Handles 200 Full Success 2009ms
Partial Batch Handling.Handles 200 With All Ok 3031ms
Partial Batch Handling.Does Not Retry Dropped Events 3030ms
Partial Batch Handling.Does Not Retry Limited Events 3032ms
Partial Batch Handling.Prunes Ok Events On Partial Retry 5135ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry 5136ms
Partial Batch Handling.Retries Only Retry Events From Partial 5137ms
Partial Batch Handling.Partial Retry Preserves Uuids 5137ms
Partial Batch Handling.Partial Retry Attempt Header Increments 5136ms
Partial Batch Handling.Partial Retry Request Id Preserved 5135ms
Partial Batch Handling.Respects Retry After On Partial 5136ms
Partial Batch Handling.Unknown Result Treated As Terminal 3031ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry 3033ms
Compression.Sends Gzip Content Encoding 7ms
Compression.No Content Encoding When Disabled 6ms
Compression.Compressed Body Is Decompressible 6ms
Error Handling.Does Not Retry On Unknown 4Xx 2131ms
Event Options.Cookieless Mode Override 7ms
Event Options.Disable Skew Correction Override 6ms
Event Options.Process Person Profile Override 5ms
Event Options.Product Tour Id Override 6ms
Event Options.Unset Options Omitted 5ms
Event Options.Options Override In Batch 9ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties 6ms
Geoip And Historical Migration.Historical Migration Set In Body 6ms
Geoip And Historical Migration.Historical Migration Absent By Default 6ms

Feature_Flags Tests

⚠️ 15/17 tests passed, 2 failed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 15ms
Request Payload.Flags Request Uses V2 Query Param 16ms
Request Payload.Flags Request Hits Flags Path Not Decide 15ms
Request Payload.Flags Request Omits Authorization Header 15ms
Request Payload.Token In Flags Body Matches Init 16ms
Request Payload.Groups Round Trip 16ms
Request Payload.Groups Default To Empty Object 15ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 15ms
Request Payload.Disable Geoip Omitted Defaults To False 16ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 16ms
Request Lifecycle.No Flags Request On Init Alone 2ms
Request Lifecycle.No Flags Request On Normal Capture 6ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 29ms
Request Lifecycle.Mock Response Value Is Returned To Caller 16ms
Retry Behavior.Retries Flags On 502 5ms
Retry Behavior.Retries Flags On 504 5ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 17ms

Failures

retry_behavior.retries_flags_on_502

500, message='Internal Server Error', url='http://sdk-adapter:8080/get_feature_flag'

retry_behavior.retries_flags_on_504

500, message='Internal Server Error', url='http://sdk-adapter:8080/get_feature_flag'

@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "feat: send error tracking stack frames i..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant